<template>
  <div class="recommend-list">
    <h1 class="list-title">热门歌单推荐</h1>
    <ul>
      <li
        v-for="item in albums"
        class="item"
        :key="item.id"
        @click="selectItem(item)"
      >
        <div class="icon">
          <img width="60" height="60" v-lazy="item.pic" />
        </div>
        <div class="text">
          <h2 class="name">
            {{ item.username }}
          </h2>
          <p class="title">
            {{ item.title }}
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    albums: {
      type: Array,
      default: () => []
    }
  },
  setup (props, { emit }) {
    const selectItem = (singer) => {
      emit('todetail', singer)
    }
    return { selectItem }
  }
}
</script>

<style scoped lang="scss">
.recommend-list {
  .list-title {
    height: 65px;
    line-height: 65px;
    text-align: center;
    font-size: $font-size-medium;
    color: $color-theme;
  }
  .item {
    display: flex;
    box-sizing: border-box;
    align-items: center;
    padding: 0 20px 20px 20px;

    .icon {
      flex: 0 0 60px;
      width: 60px;
      padding-right: 20px;
    }
    .text {
      display: flex;
      flex-direction: column;
      justify-content: center;
      flex: 1;
      line-height: 20px;
      overflow: hidden;
      font-size: $font-size-medium;
    }
    .name {
      margin-bottom: 10px;
      color: $color-text;
    }
    .title {
      color: $color-text-d;
    }
  }
}
</style>
